<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/4/13 0013 19:28
 */
require_once "common.php";
if($_POST) {
    $filename = "./template/" . iconv("utf-8","gb2312",$_POST['category']). "_" . iconv("utf-8","gb2312",$_POST['name']);
    move_uploaded_file($_FILES['pic']['tmp_name'], $filename . ".jpg");
    move_uploaded_file($_FILES['file']['tmp_name'], $filename . ".zip");
    header('location:list.php');
    exit;
}
?>
<!DOCTYPE html>
<html>
<head>
<title>上传新站点</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="Boundary Sign in Form template Responsive, Login form web template,Flat Pricing tables,Flat Drop downs  Sign up Web Templates, Flat Web Templates, Login sign up Responsive web template, SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, Sony Ericsson, Motorola web design" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- Custom Theme files -->
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<!-- //Custom Theme files -->
<!-- web font -->
<link href='//fonts.googleapis.com/css?family=Oxygen:400,700' rel='stylesheet' type='text/css'>
<!-- //web font -->
</head>
<body>
	<h1>上传新站点</h1>
<!--form-stars-here-->
		<div class="login-form w3-agile">
			<h2>上传新站点</h2>
			<form action="#" method="post" enctype="multipart/form-data">
                <p>站点分类</p>
                <select name="category">
                    <option>科技信息</option>
                    <option>医院医疗专题</option>
                    <option>卡通主题</option>
                </select>
                <p>站点名称</p>
                <input type="text" name="name" placeholder=" " required="" />
                <p>缩略图</p>
                <input type="file" name="pic" placeholder=" " required="" />
                <p>选择文件</p>
                <input type="file" name="file" placeholder=" " required="" />
                <p>注意，上传zip格式，并且所有内容直接放在根目录</p>
                <input type="submit" value="上传">
                <a href="list.php">查看所有已有站点</a>
			</form>
		</div>
<!--//form-ends-here-->
<!-- copyright -->
	<div class="copyright w3-agile">
		<p> © 2017 Design Sign in  . All rights reserved | Design by Liu</p>
	</div>
	<!-- //copyright --> 
</body>
</html>